﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Cisoft.Booking.Model;
using Cisoft.Booking.BLL;

public partial class Business_MessageDetail : WebUI.Page.BasePage
{
    private RuleMO ruleMO = new RuleMO();
    private RuleBO ruleBO = new RuleBO();
    private ShortMessageBO smBO = new ShortMessageBO();
    private ShortMessageMO smMO = new ShortMessageMO();
    private SetBO sBO = new SetBO();
    private SetMO sMO = new SetMO();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            FillModel();
        }
    }

    #region 返回事件
    /// <summary>
    /// 返回事件
    /// </summary>
    protected void btnBack_Click(object sender, ImageClickEventArgs e)
    {
        //Response.Redirect(Request.RawUrl);
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "history.go(-2);", true);
    }
    #endregion

    #region 获得规则标识 int GetSMSID()
    /// <summary>
    /// 获得规则标识
    /// </summary>
    private int GetSMSID()
    {
        int id = 0;
        if (Request.QueryString["ShortMessageID"] != null)
        {
            id = int.Parse(Request.QueryString["ShortMessageID"].ToString());
        }

        return id;
    }
    #endregion

    #region 填充页面表格 void FillModel()
    /// <summary>
    /// 填充页面表格
    /// </summary>
    private void FillModel()
    {
        int id = GetSMSID();
        if (id > 0)
        {
            smMO = smBO.GetModel(id);

            lbl_Type.Text = smMO.ShortMessageType;
            lbl_ShortMessageSend.Text = smMO.ShortMessageSend;
            lbl_Recive.Text = smMO.ShortMessageRecive;
            DateTime dt = Convert.ToDateTime(smMO.ShortMessageSendTime);
            lbl_SendTime.Text = dt.GetDateTimeFormats('f')[0].ToString();
            lbl_Content.Text = smMO.ShortMessageContent;

        }
        else
        {
            PageError("系统不存在该短信！", Request.RawUrl);
        }
    }
    #endregion

}
